﻿using Microsoft.AspNetCore.Mvc;
using PowerHub.MES.Common.Utility;
using PowerHub.MES.DTO.BasicData.DTO;
using PowerHub.MES.DTO.BasicData.QueryDto;
using PowerHub.MES.DTO.Shopfloor.DTO;
using PowerHub.MES.DTO.Shopfloor.QueryDTO;
using PowerHub.MES.Entities.BasicData;
using PowerHub.MES.Entities.Shopfloor;
using PowerHub.MES.IServices.IBasic;
using PowerHub.MES.IServices.IShopfloor;
using PowerHub.MES.ReturnEntity;
using PowerHub.MES.Services.Shopfloor;

namespace PowerHub.MES.Controllers.WorkStation
{

    /// <summary>
    /// 工作站
    /// </summary>
    [ApiController]
    [Route("Api/MES/Shopfloor/[controller]/[action]")]
    public class WorkStationController
    {

        private IShopfloor_WorkStationServices _shopfloor_WorkStationServices;

        public WorkStationController(IShopfloor_WorkStationServices WorkStationServices)
        {
            _shopfloor_WorkStationServices = WorkStationServices;
        }

        /// <summary>
        /// 获取工作站列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取工作站列表")]
        public async Task<OperationPageResult<List<Shopfloor_WorkStation>>> GetShopfloor_WorkStationPageListAsync([FromBody] QueryShopfloor_WorkStationDTO pageQuery)
        {
            return await _shopfloor_WorkStationServices.GetShopfloor_WorkStationPageListAsync(pageQuery);
        }


        /// <summary>
        /// 批量删除工作站
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("批量删除工作站")]
        public async Task<OperationResult<object>> DeletionShopfloor_WorkStationAsync([FromBody] List<string> Query)
        {
            return await _shopfloor_WorkStationServices.DeletionShopfloor_WorkStationAsync(Query);
        }

        /// <summary>
        /// 更新工作站
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("更新工作站")]
        public async Task<OperationResult<object>> UpdateShopfloor_WorkStationAsync([FromBody] Shopfloor_WorkStationDTO Query)
        {
            return await _shopfloor_WorkStationServices.UpdateShopfloor_WorkStationAsync(Query);
        }

        /// <summary>
        /// 添加工作站
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("添加工作站")]
        public async Task<OperationResult<object>> CreateShopfloor_WorkStationAsync([FromBody] Shopfloor_WorkStationDTO Query)
        {
            return await _shopfloor_WorkStationServices.CreateShopfloor_WorkStationAsync(Query);
        }
    }
}
